package org.oos.auth;

import static org.oos.auth.AuthConstants.*;
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl;
import com.google.api.client.util.Key;

/**
 * 
 * Extension of {@link OAuthAuthorizeTemporaryTokenUrl} to allow for privileges
 * on 11870.com
 * 
 * @author pablo.gonzalez@11870.com
 * 
 */
public class OosTemporaryTokenOAuthUrl extends OAuthAuthorizeTemporaryTokenUrl {

	@Key
	private String privilege = Privilege.Read.toString().toLowerCase();

	public static enum Privilege {
		Read, Write;
	}

	public OosTemporaryTokenOAuthUrl() {
		super(AUTHORIZE_TEMP_TOKEN_URL);
	}

	public OosTemporaryTokenOAuthUrl setPrivilege(Privilege privilege) {
		this.privilege = privilege.toString().toLowerCase();
		return this;
	}

	public Privilege getPrivilege() {
		return Privilege.valueOf(privilege);
	}

}
